<?php

/**
 * @see Zend_Filter_Interface
 */
require_once 'Zend/Filter/Interface.php';


/**
 * Koduje ID
 *
 * @category   Core
 * @package    Core_Filter
 * @copyright  Copyright (c) 2008 Kuśmierz Adam
 * @author Adam Kuśmierz
 */
class Core_Filter_EncodeID implements Zend_Filter_Interface
{
	/**
	 * Defined by Zend_Filter_Interface
	 *
	 * Returns (string) $value
	 *
	 * @param  int $value
	 * @return string
	 */
	public function filter($value)
	{
		$value = intval($value);
		
		if ($value < 0)
			return false;
		
		$value = str_pad($value, 10, 0, STR_PAD_LEFT);
		$value = rand(11, 99) . $value;
		$value = base_convert($value, 10, 36);
		return $value;
	}
}
